package com.wps.shell.controls.commonWindow
{
	import flash.events.MouseEvent;
	import flash.filters.GlowFilter;
	
	import mx.core.IVisualElement;
	
	import spark.components.Button;
	import spark.components.Group;
	import spark.components.Label;
	import spark.components.supportClasses.SkinnableComponent;

	public class ComWindowBackGround extends SkinnableComponent
	{
		/**
		 * 宽高限定值。
		 * @private
		 */
		private static const MIN_WIDTH: int				= 120;
		private static const MIN_HEIGHT: int			= 26;
		private static const MINEDWIDTH: int			= 180;
		private static const BORDERWIDTH: int			= 4;
		
		/**
		 * 关闭按钮
		 * @private
		 */
		[SkinPart(required="false")]
		public var closeButton: Button;
		
		/**
		 * 最大化按钮
		 * @private
		 */
		[SkinPart(required="false")]
		public var maximizeButton: Button;
		
		/**
		 * 最小化按钮
		 * @private
		 */
		[SkinPart(required="false")]
		public var minimizeButton: Button;
		
		[SkinPart(required="true")]
		public var labelDiaplay: Label;
		
		[Bindable]
		public var text: String;
		
		[Bindable]
		public var titleHeight: Number = 26;
		
		[Bindable]
		public var borderThicknessTop: Number = 5;
		[Bindable]
		public var borderThicknessRight: Number = 5;
		[Bindable]
		public var borderThicknessLeft: Number = 5;
		[Bindable]
		public var borderThicknessBottom: Number = 5;
		
		[Bindable]
		public var contentBackGroundColor: Number = 0xFFFFFF;
		
		private var _titleGlow:GlowFilter = new GlowFilter(0xFFFFFF, 0.75, 12, 12, 2);
		
		public function ComWindowBackGround()
		{
			super();
			isPopUp = true;
			minWidth = MIN_WIDTH;
			minHeight = MIN_HEIGHT;
			this.percentHeight = 100;
			this.percentWidth = 100;
			
			mouseFocusEnabled = false;
		}
		
		override protected function createChildren():void
		{
			super.createChildren();
			
			labelDiaplay.mouseChildren = false;
			labelDiaplay.mouseEnabled = false;
			labelDiaplay.mouseFocusEnabled = false;
			labelDiaplay.filters = [_titleGlow];
			
			//禁用skin中的Group的鼠标
			var skinGroup: Group = Group(this.skin);
			var skinChildrenLength: int = skinGroup.numElements;
			for(var i: int = 0; i < skinChildrenLength; i++)
			{
				var elem: IVisualElement = skinGroup.getElementAt(i);
				if(elem is Group)
				{
					Group(elem).mouseEnabled = false;
				}
			}
		}
		
		public function destroy(): void
		{
		}
		
	}
}